//
// Created by squbirreland on 2021/11/19.
//

#ifndef RLIB_RESULT_H
#define RLIB_RESULT_H

#include "types.h"

enum ErrorCode {
    Unknown = 1
};

char * err_message(enum ErrorCode err);

struct Result {
    _Bool success;
    union {
        void const *p;
        enum ErrorCode err;
    };
};

struct Result *result_success(void const *p);

struct Result *result_failed(enum ErrorCode err);

void const *result_panic(struct Result *result);

#endif //RLIB_RESULT_H
